/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package com.lifesting.wfs.Runtime.impl;

import com.lifesting.wfs.Runtime.Context;
import com.lifesting.wfs.Runtime.ForkExecutor;
import com.lifesting.wfs.Runtime.RuntimeFactory;
import com.lifesting.wfs.Runtime.RuntimePackage;
import com.lifesting.wfs.Runtime.Token;
import com.lifesting.wfs.gd.Transition;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Fork Executor</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * </p>
 *
 * @generated
 */
public class ForkExecutorImpl extends NodeExecutorImpl implements ForkExecutor {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ForkExecutorImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return RuntimePackage.Literals.FORK_EXECUTOR;
	}
	@Override
	public void execute(Context ctx) {
		Token child_token = ctx.getToken().createChild();
		Context child_context= RuntimeFactory.eINSTANCE.createContext();
		copyContext(child_context,ctx);
		child_token.setContext(child_context);
		EList<Transition> trans = getNode().getTransition();
		for (Transition t : trans){
			
		}
	}
	//Set parent, and copy all variables in context.
	//TODO cby: need more advice.
	private void copyContext(Context child_context, Context ctx) {
		child_context.setParent(ctx);		
	}

} //ForkExecutorImpl
